package com.cjb.cloudsystem.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * All rights Reserved, Designed By  chenjinbin
 *
 * @author chenjinbin
 * @Project: fjbd_cjb_bs
 * @Package com.cjb.common.swaggerConfig
 * @title SwaggerConfig
 * @Description
 * @email
 * @date 2023-08-24 17:04
 * @since JDK 1.8
 */
@Configuration
@Slf4j
public class SwaggerConfig {
    @Bean
    public GroupedOpenApi userApi() {
        String[] paths = {"/**"};
        String[] packagedToMatch = {"com.cjb"};
        return GroupedOpenApi.builder().group("hatelys")
                .pathsToMatch(paths)
                .packagesToScan(packagedToMatch).build();
    }

    @Bean
    public OpenAPI customOpenAPI() {
        Contact contact = new Contact();
        contact.setName("chenjinbin 2213859123@qq.com");

        return new OpenAPI().info(new Info()
                .title("hatelys")
                .description("hatelys")
                .contact(contact)
                .version("3.0")
                .termsOfService("http://hatelys.eu.org")
                .license(new License().name("MIT")
                        .url("https://hatelys.eu.org")));
    }
}
